import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import pluginVue from 'eslint-plugin-vue'
import preiiterRecommended from 'eslint-plugin-prettier/recommended'

/** @type {import('eslint').Linter.Config[]} */
export default [
  { files: ['**/*.{js,mjs,cjs,ts,vue}'] },
  { languageOptions: { globals: { ...globals.browser, ...globals.node } } },
  pluginJs.configs.recommended,
  ...tseslint.configs.recommended,
  ...pluginVue.configs['flat/essential'],
  {
    files: ['**/*.vue'], // 校验vue中的ts代码
    languageOptions: { parserOptions: { parser: tseslint.parser } }
  },
  {
    // 自定义规则
    rules: {
      'vue/multi-word-component-names': 'off'
    }
  },
  preiiterRecommended // 覆盖掉eslint的规范
]
